const express = require('express');
const Photos = require('../model/Photos')
const router = express.Router()

router.post('/photos', async (req, res) => {
    const newPhotos = await new Photos(req.body).save()
    console.log(newPhotos);
    res.send({
        status: 200,
        msg: '增加图片成功！'
    })
})

router.get('/getphotos', async (req, res) => {
    const photoslist = await Photos.find()
    console.log(photoslist);
    res.send({
        status: 200,
        photoslist
    })
})

module.exports = router
